Conversation
|
I’m trying to merge this into the lean4 branch, but trying to update the |
|
Just ran the tests locally again to make sure, it all seems fine to me. I haven't changed either of them, so thats very weird. |
|
Also, for visibility (I put this in #207 but not here). After some testing on the rocq output, it seems like some recursive functions turning into relations do not pass as it doesn't pass the strictly positive condition. Lean will likely exhibit a similar error on the function utf8. |
That function definition is in |
Fair enough, but did some more quick testing and it happens to most recursive functions (subst_typevar and subst_typeuse for example) |
|
Maybe we need to push harder to make them translate as functions. At least when the premises are on identical patterns like in and they are all booleans or otherwise, it should be possible to translate that as if-then-else, shouldn’t it? |
Yes, that was one of the things I was thinking of doing as well, for premises that are boolean conditions. I wanted a more general approach first though to see if it worked. In some functions by the way, you can also transform some of the if premises into let premises (look at growmem for example) and any iterpr with boolean conditions could be List.all |
|
With the new changes, the fallthrough premises no longer cause a (big) problem. Wasm 3.0 was compiled in Rocq (with some spec changes for partial funcs). |
|
Changed this to only do fallthrough whenever it spots an otherwise premise, instead of all the time. This is in line with what the actual semantics is supposed to be. Other than maybe fixing names and reordering premises, this should be good to start being reviewed. It is a pretty complicated one to review though. |
Yeah, I’m not sure if I can do a meaningful review :-/ |
Fair enough! I will probably just keep it as a draft until we make use of this pass in the mechanization backends. Will also try to make it more readable! |
…he recursive functions themselves.
…that removes ones that have reference to the return expression.
…ng new traversal method
9c4be10 to
96f7ea3
Compare
…xp params) into relations.
661e6e4 to
e5d20ef
Compare
This pull request is made to introduce the pass "deftorel". This pass does as the name suggests: convert specific function definitions to relations.
Example:
to
This pass does not ensure the created relations that handle the fallthrough semantics have unique name (yet).
Currently a draft as its not meant to be mergable yet, since more testing should be done to ensure it does the right thing. But for now it should give a way to track what is happening with this pass.
Validates up to Wasm 3.0. Have not tested it in Rocq, but will probably not compile due to name clashes.
Some todos:
This would be possible for boolean conditions but not for anything else. Maybe thats fine?